home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / LogonFrame.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  3.3 KB  |  116 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import java.awt.Button;
  4. import java.awt.Color;
  5. import java.awt.Component;
  6. import java.awt.Container;
  7. import java.awt.Event;
  8. import java.awt.Frame;
  9. import java.awt.Label;
  10. import java.awt.LayoutManager;
  11. import java.awt.TextField;
  12. import symantec.itools.awt.KeyPressManagerPanel;
  13. import symantec.itools.db.pro.ConnectionInfo;
  14. import symantec.itools.db.pro.Logon;
  15.  
  16. public class LogonFrame extends Frame implements Logon {
  17.    KeyPressManagerPanel keyPressManagerPanel1;
  18.    // $FF: renamed from: OK java.awt.Button
  19.    Button field_0;
  20.    Button Cancel;
  21.    TextField UserNameEdit;
  22.    TextField UserPasswordEdit;
  23.    Label label3;
  24.    Label label4;
  25.    Label datasource;
  26.    Label datasource1;
  27.    ConnectionInfo m_ConnectionInfo;
  28.    boolean m_Action;
  29.  
  30.    public LogonFrame() {
  31.       super("LogonFrame window");
  32.       ((Container)this).setLayout((LayoutManager)null);
  33.       ((Frame)this).addNotify();
  34.       ((Component)this).resize(((Container)this).insets().left + ((Container)this).insets().right + 360, ((Container)this).insets().top + ((Container)this).insets().bottom + 152);
  35.       ((Component)this).setBackground(new Color(12632256));
  36.       this.keyPressManagerPanel1 = new KeyPressManagerPanel();
  37.       this.keyPressManagerPanel1.setLayout((LayoutManager)null);
  38.       this.keyPressManagerPanel1.reshape(((Container)this).insets().left, ((Container)this).insets().top, 360, 152);
  39.       ((Container)this).add(this.keyPressManagerPanel1);
  40.       this.field_0 = new Button("OK");
  41.       this.field_0.reshape(68, 108, 85, 25);
  42.       this.keyPressManagerPanel1.add(this.field_0);
  43.       this.Cancel = new Button("Cancel");
  44.       this.Cancel.reshape(164, 108, 85, 25);
  45.       this.keyPressManagerPanel1.add(this.Cancel);
  46.       this.UserNameEdit = new TextField(28);
  47.       this.UserNameEdit.reshape(164, 37, 166, 23);
  48.       this.keyPressManagerPanel1.add(this.UserNameEdit);
  49.       this.UserPasswordEdit = new TextField(28);
  50.       this.UserPasswordEdit.setEchoCharacter('*');
  51.       this.UserPasswordEdit.reshape(164, 65, 166, 23);
  52.       this.keyPressManagerPanel1.add(this.UserPasswordEdit);
  53.       this.label3 = new Label("User Name:");
  54.       this.label3.reshape(56, 40, 90, 15);
  55.       this.keyPressManagerPanel1.add(this.label3);
  56.       this.label4 = new Label("Password:");
  57.       this.label4.reshape(64, 68, 90, 15);
  58.       this.keyPressManagerPanel1.add(this.label4);
  59.       this.datasource = new Label("DataSource Name:");
  60.       this.datasource.reshape(16, 5, 133, 15);
  61.       this.keyPressManagerPanel1.add(this.datasource);
  62.       this.datasource1 = new Label("DataSource Name:");
  63.       this.datasource1.reshape(164, 5, 200, 15);
  64.       this.keyPressManagerPanel1.add(this.datasource1);
  65.       ((Frame)this).setTitle("Untitled");
  66.    }
  67.  
  68.    public void show() {
  69.       super.show();
  70.    }
  71.  
  72.    public boolean handleEvent(Event var1) {
  73.       if (var1.id == 1001 && var1.target == this.Cancel) {
  74.          this.clickedCancel();
  75.          return true;
  76.       } else if (var1.id == 1001 && var1.target == this.field_0) {
  77.          this.clickedOK();
  78.          return true;
  79.       } else if (var1.id == 201) {
  80.          ((Component)this).hide();
  81.          return true;
  82.       } else {
  83.          return super.handleEvent(var1);
  84.       }
  85.    }
  86.  
  87.    public void clickedOK() {
  88.       this.m_ConnectionInfo.setUser(this.UserNameEdit.getText());
  89.       this.m_ConnectionInfo.setPassword(this.UserPasswordEdit.getText());
  90.       this.m_Action = true;
  91.       ((Component)this).hide();
  92.    }
  93.  
  94.    public void clickedCancel() {
  95.       this.m_Action = false;
  96.       ((Component)this).hide();
  97.    }
  98.  
  99.    public boolean logonFailed(ConnectionInfo var1, int var2) {
  100.       this.m_ConnectionInfo = var1;
  101.       this.UserNameEdit.setText(var1.getUser());
  102.       this.UserPasswordEdit.setText(var1.getPassword());
  103.       this.datasource1.setText(var1.getDBString());
  104.       ((Frame)this).setTitle("User Authentication");
  105.       this.show();
  106.  
  107.       while(((Component)this).isVisible()) {
  108.          Thread.currentThread();
  109.          Thread.yield();
  110.       }
  111.  
  112.       var1 = this.m_ConnectionInfo;
  113.       return this.m_Action;
  114.    }
  115. }
  116.